import { EntitySchema } from "typeorm";

// 定义用户实体的接口
export interface User {
  id: number;
  name: string;
  email: string;
  age: number;
  createdAt: Date;
}

// 使用 EntitySchema 定义实体
export const UserSchema = new EntitySchema<User>({
  name: "User",
  columns: {
    id: {
      type: Number,
      primary: true,
      generated: true,
    },
    name: {
      type: String,
    },
    email: {
      type: String,
    },
    age: {
      type: Number,
    },
    createdAt: {
      type: Date,
      createDate: true,
    },
  },
});
